package com.ruoyi.server.api.booking.service.impl;

import java.util.Collections;
import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.server.api.booking.mapper.ImgBookingMapper;
import com.ruoyi.server.api.booking.domain.ImgBooking;
import com.ruoyi.server.api.booking.service.IImgBookingService;

/**
 * 预约到店Service业务层处理
 *
 * @author lx
 * @date 2024-10-22
 */
@Service
public class ImgBookingServiceImpl implements IImgBookingService {
    @Autowired
    private ImgBookingMapper imgBookingMapper;


    /**
     * 查询预约到店
     *
     * @param id 预约到店主键
     * @return 预约到店
     */
    @Override
    public ImgBooking selectImgBookingById(Long id) {
        return imgBookingMapper.selectImgBookingById(id);
    }

    /**
     * 查询预约到店列表
     *
     * @param imgBooking 预约到店
     * @return 预约到店
     */
    @Override
    public List<ImgBooking> selectImgBookingList(ImgBooking imgBooking) {
        return imgBookingMapper.selectImgBookingList(imgBooking);
    }

    /**
     * 新增预约到店
     *
     * @param imgBooking 预约到店
     * @return 结果
     */
    @Override
    public int insertImgBooking(ImgBooking imgBooking) {
        imgBooking.setCreateTime(DateUtils.getNowDate());
        return imgBookingMapper.insertImgBooking(imgBooking);
    }

    /**
     * 修改预约到店
     *
     * @param imgBooking 预约到店
     * @return 结果
     */
    @Override
    public int updateImgBooking(ImgBooking imgBooking) {
        return imgBookingMapper.updateImgBooking(imgBooking);
    }

    /**
     * 批量删除预约到店
     *
     * @param ids 需要删除的预约到店主键
     * @return 结果
     */
    @Override
    public int deleteImgBookingByIds(Long[] ids) {
        return imgBookingMapper.deleteImgBookingByIds(ids);
    }

    /**
     * 删除预约到店信息
     *
     * @param id 预约到店主键
     * @return 结果
     */
    @Override
    public int deleteImgBookingById(Long id) {
        return imgBookingMapper.deleteImgBookingById(id);
    }

    /**
     * @param imgBooking
     * @Author Lx
     * @Description 新增预约方法
     * @Date 2024/10/24 11:02
     * @Return int
     */
    @Override
    public int saveBooking(ImgBooking imgBooking) {
        return imgBookingMapper.saveBooking(imgBooking);
    }

    /**
     * @param userId
     * @Author Lx
     * @Description 根据用户id查询预约信息列表
     * @Date 2024/10/24 11:03
     * @Return java.util.List<com.ruoyi.server.api.booking.domain.ImgBooking>
     */
    @Override
    public List<ImgBooking> selectImgBookingListByuserId(String userId) {
        return imgBookingMapper.bookingListByUserId(userId);
    }

    /**
     * @Author Lx
     * @Description 查询预约信息列表
     * @Date 2024/10/24 11:03
     * @Return java.util.List<com.ruoyi.server.api.booking.domain.ImgBooking>
     */
    @Override
    public List<ImgBooking> selectBoikings() {
        return imgBookingMapper.selectBookings();
    }

    /**
     * @param id
     * @Author Lx
     * @Description 更新预约状态的方法
     * @Date 2024/10/24 11:03
     * @Return int
     */
    @Override
    public int updateBookingStatus(Long id) {
        return imgBookingMapper.updateBookingStatus(id);
    }

    @Override
    public List<ImgBooking> selectBookingsByUser(String userId) {
        return imgBookingMapper.selectBookingsByUser(userId);
    }

    @Override
    public int deleteBookingById(Long id) {
        return imgBookingMapper.deleteBookingById(id);
    }

    @Override
    public int completeOrder(Long id) {
        return imgBookingMapper.completeOrder(id);
    }

}
